<?php
function check_back_link($remote_url, $your_link) {
    $match_pattern = preg_quote(rtrim($your_link, "/"), "/");
    echo $match_pattern ;
    $found = false;
    if ($handle = @fopen($remote_url, "r")) {
    	
    
        while (!feof($handle)) {
        		
            $part = fread($handle, 1024);
            echo $part;
            if (preg_match("/<a(.*)href=[\"\']".$match_pattern.
"(\/?)[\"\'](.*)>(.*)<\/a>/", $part)) {
                $found = true;
                break;
            }
        }
        fclose($handle);
    }
    return $found;
}

if (check_back_link("http://statius.ktusa.lt", "http://tygas.net")) 
	echo "link exists";
	else echo "NO";





?>
